package com.jdrx.sw.sewage.api.web;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.jdrx.platform.commons.rest.beans.vo.ResponseVO;
import com.jdrx.platform.commons.rest.factory.ResponseFactory2;
import com.jdrx.sw.sewage.beans.dto.MedicineCategoryAddDTO;
import com.jdrx.sw.sewage.beans.entity.MedicineCategoryPO;
import com.jdrx.sw.sewage.beans.vo.MedicinePointOptionVO;
import com.jdrx.sw.sewage.service.MedicineCategoryService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping(value = "/api/medicineCategory")
@Api(value = "药剂类型")
public class MedicineCategoryApi {
	@Autowired
	private MedicineCategoryService medicineCategoryService;
	
	@ApiOperation(value = "新增药剂类型")
    @PostMapping(value = "add")
    public ResponseVO<?> add(@RequestBody @Validated MedicineCategoryAddDTO dto) {
		medicineCategoryService.add(dto);
        return ResponseFactory2.ok();
    }
	
	@ApiOperation(value = "药剂类型列表")
    @PostMapping(value = "list")
    public ResponseVO<List<MedicineCategoryPO>> list() {
        return ResponseFactory2.ok(medicineCategoryService.listAll());
    }
	
	@ApiOperation(value = "点位列表")
    @PostMapping(value = "pointOptions")
    public ResponseVO<List<MedicinePointOptionVO>> pointOptions() {
        return ResponseFactory2.ok(medicineCategoryService.pointOptions());
    }
}